define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'retail.sotre/index',
        add_url: 'retail.sotre/add',
        edit_url: 'retail.sotre/edit',
        delete_url: 'retail.sotre/delete',
        export_url: 'retail.sotre/export',
        modify_url: 'retail.sotre/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id'},
                    {field: 'goods_name', title: '分销商品名称'},
                    {field: 'goods_img', title: '分销商品封面',search: false, templet: ea.table.image},
                    {field: 'goods_price', title: '分销商品价格'},
                    {field: 'agent.agent_name', title: '代理名称'},
                    {field: 'agent.agent_icon', title: '代理图标'},
                    {field: 'agent.self_save_money', title: '自购省钱'},
                    {field: 'agent.first_brokerage', title: '一级分佣'},
                    {field: 'agent.second_brokerage', title: '二级分佣'},
                    {field: 'agent.third_brokerage', title: '三级分佣'},
                    {field: 'agent.create_time', title: ''},
                    {width: 250, title: '操作', templet: ea.table.tool},

                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});